package com.haoshuang.zhouzhoubang.ui.page.study.exam

import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemExamQuestionsBinding
import com.haoshuang.zhouzhoubang.model.bean.QuestionBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.imageResource


/**
 * 
 */
class ExamQuestionsAdapter(data: MutableList<QuestionBean>) : BaseBindingQuickAdapter<QuestionBean, ItemExamQuestionsBinding>(data) {

    override fun onBindViewHolder(holder: BaseBindingHolder, position: Int, item: QuestionBean?) {
        holder.getViewBinding<ItemExamQuestionsBinding>().apply {

            tvAnswer.text = item?.desc
            when(item?.title){
                "A" -> {
                    if (item.is_Check != 0){
                        ivAnswer.imageResource = R.mipmap.icon_optioned_a
                    }else{
                        ivAnswer.imageResource = R.mipmap.icon_option_a
                    }
                }
                "B" -> {
                    if (item.is_Check != 0){
                        ivAnswer.imageResource = R.mipmap.icon_optioned_b
                    }else{
                        ivAnswer.imageResource = R.mipmap.icon_option_b
                    }
                }
                "C" -> {
                    if (item.is_Check != 0){
                        ivAnswer.imageResource = R.mipmap.icon_optioned_c
                    }else{
                        ivAnswer.imageResource = R.mipmap.icon_option_c
                    }
                }
                "D" -> {
                    if (item.is_Check != 0){
                        ivAnswer.imageResource = R.mipmap.icon_optioned_d
                    }else{
                        ivAnswer.imageResource = R.mipmap.icon_option_d
                    }
                }
            }

        }
    }

}